1bashThis demonstrates checking if a file exists and is readable using the -r conditional expression.[[ -r FILE ]]bash internalflow controltests (conditions)file condition
2bashThis demonstrates checking for the existence of a file in Bash.if [[ -e "file.txt" ]]; then echo "file exists" fibash internalflow controltests (conditions)file condition
3bashThis demonstrates checking if a file is a symbolic link using the -h conditional expression in Bash.[[ -h FILE ]]bash internalflow controltests (conditions)file condition
4bashThis demonstrates checking if a file exists and is non-empty using the -s condition in Bash.[[ -s FILE ]]bash internalflow controltests (conditions)file condition
5bashThis demonstrates checking if a file is writable using the -w flag in a conditional expression.[[ -w FILE ]]bash internalflow controltests (conditions)file condition
6bashThis demonstrates comparing the modification times of two files using the -ot test operator in Bash.[[ FILE1 -ot FILE2 ]]bash internalflow controltests (conditions)file condition
7bashThis demonstrates comparing file modification times using the -nt test operator in Bash.[[ FILE1 -nt FILE2 ]]bash internalflow controltests (conditions)file condition
8bashThis demonstrates checking if two files are hard links to the same file by comparing their inode numbers and device IDs.[[ FILE1 -ef FILE2 ]]bash internalflow controltests (conditions)file condition
9bashThis demonstrates checking if a file exists and is executable using the -x flag.[[ -x FILE ]]bash internalflow controltests (conditions)file condition
10bashThis demonstrates checking if a file exists and is a regular file using the -f condition in Bash.[[ -f FILE ]]bash internalflow controltests (conditions)file conditionfile existence
11bashThis demonstrates how to check if a file does not exist in Bash using a negated condition.# Check if a file does NOT exist if [ ! -f "example.txt" ]; then echo "File 'example.txt' does not exist." else echo "File 'example.txt' exists." fibash internalflow controltests (conditions)file condition